


<include file="Layout/header" />
<div class="mws-panel grid_8">
    <div class="mws-panel-header">
        <span><i class="icon-table"></i> 分类管理</span>
    </div>
    <div class="mws-panel-body no-padding">
        <div class="dataTables_wrapper" role="grid">
            <div id="DataTables_Table_1_length" class="dataTables_length"><label>Show <select size="1" name="DataTables_Table_1_length" ><option value="10" selected="selected">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option></select> entries</label></div><div class="dataTables_filter" id="DataTables_Table_1_filter"><label>Search: <input type="text" ></label></div><table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1" aria-describedby="DataTables_Table_1_info">
                <thead>
                    <tr>
                        <th >ID</th>
                        <th >分类名称</th>
                        <th >描述</th>
                        <th >操作</th></tr>
                </thead>
                <tbody>
                <foreach name="data" item="v">
                    <tr>
                        <td>{$v['id']}</td>
                        <td>{$v['_html']}</td>
                        <td>{$v['description']}</td>
                        <td>
                            <a href="__URL__/edit/id/{$v['id']}" class="btn btn-primary">修改</a>&nbsp;&nbsp;
                            <a href="javascript:;" data-id="{$v['id']}" class="btn btn-danger del">删除</a>
                        </td>
                    </tr>
                </foreach>
                <script type="text/javascript">

                    $('.del').click(function () {
                        var id = $(this).attr('data-id');
                        
                        layer.confirm('确定删除该分类？', {
                            btn: ['确定', '取消']
                        }, function () {
                             
                           $.get('{:U('Sort/destroy')}',{'id':id} ,function(data) {
                            // alert(data)
                                if (data == 2) {
                                  layer.msg('已经删除', {icon: 1}); 
                                  window.location.reload();  
                              }else{
                                   layer.msg('还有子集', {icon: 2}); 
                              }
                               
                           });
                        });
                    });
                </script>
                </tbody>
            </table>
            <style type="text/css">
                div.meneame{padding:3px;font-size:80%;margin:3px;color:#fff;text-align:center;}
                div.meneame a{border:#fff 1px solid;padding:5px 7px;background-position:50% bottom;margin:0 3px 0 0;text-decoration:none;}
                div.meneame a:hover{border:#ff9600 1px solid;background-image:none;color:#ff6500;background-color:#ffc794;}
                div.meneame a:active{border:#ff9600 1px solid;background-image:none;color:#ff6500;background-color:#ffc794;}
                div.meneame span.current{border:#fff 1px solid;padding:5px 7px;font-weight:bold;color:#ff6500;margin:0 3px 0 0;background-color:#fff;}
                div.meneame span.disabled{border:#ffe3c6 1px solid;padding:5px 7px;color:#ffe3c6;margin:0 3px 0 0;}

            </style>
            <div class="meneame">
                {$show}
            </div>
        </div>
    </div>
    <include file="Layout/footer" />
